﻿using System;
using System.Windows.Forms;
using Detective.View.Base;
using Detective.World;

namespace Detective.View.ConsoleViews
{
    public class MainView : BaseMdiView
    {
        public MainView()
        {
            Console.CursorVisible = false;
        }

        protected override void OnRefreshMdiView()
        {
            Console.Clear();

            Console.WriteLine("<Esc> Выход из игры.");
            Console.WriteLine();
            Console.WriteLine("1. Помощь.");
            Console.WriteLine("2. Посмотреть почту.");
            Console.WriteLine();
            Console.WriteLine(WorldShell.Instance.CurrentTown.CurrentPlace.WhereAmI());
            Console.WriteLine();
            Console.WriteLine(WorldShell.Instance.CurrentTown.Time.GetTimeMessage());
            Console.WriteLine();
            Console.WriteLine(WorldShell.Instance.CurrentTown.Time.ToString());
        }

        public override void OnKeyDown(KeyEventArgs arg)
        {
            base.OnKeyDown(arg);

            if (arg.Handled == false)
            {
                switch (arg.KeyCode)
                {
                    case Keys.Escape:
                        Environment.Exit(0);
                        break;
                    case Keys.D1:
                        Show<HelpView>();
                        break;
                    case Keys.D2:
                        Show<MailView>();
                        break;
                }
            }
        }
    }
}
